package com.ivan.toolkit.swing;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.border.MatteBorder;

public class UnderlineButton extends JButton {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8552579036104601087L;

	public UnderlineButton() {
		super();
		
		//underlineButton.setBorder(new MatteBorder(0, 0, 1, 0, (Color) new Color(0, 0, 0)));
		setContentAreaFilled(false);
		setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		setBorder(new MatteBorder(0, 0, 1, 0, UnderlineButton.this.getForeground()));
		
		
		
		addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent arg0) {
				UnderlineButton.this.setOpaque(true);
			}

			@Override
			public void mouseExited(MouseEvent e) {
				UnderlineButton.this.setOpaque(false);
			}
		});
		
	}

	@Override
	public void setForeground(Color fg) {
		super.setForeground(fg);
		setBorder(new MatteBorder(0, 0, 1, 0, this.getForeground()));
	}
	
	

	
	
	
	
	
}
